package com.vip.iot.util;

import org.springframework.util.StringUtils;

/**
 * @author flj
 * @date 2019/2/27
 **/
public class IotUtil {
    /**
     * 字符串拼接
     *
     * @author flj
     * @date 2019/2/27 12:20
     */
    public static String charSplice(String... objs) {
        StringBuilder sum = new StringBuilder();
        if (objs != null && objs.length > 1) {
            String spliceChar = objs[0];
            for (int i = 1; i < objs.length; i++) {
                sum.append(objs[i]);
                if (i < objs.length - 1) {
                    sum.append(spliceChar);
                }
            }
        }
        return sum.toString();
    }

    /**
     * 字符串拆解
     *
     * @author flj
     * @date 2019/2/27 12:20
     */
    public static String[] charSplite(String spliceChar, String object) {
        return StringUtils.isEmpty(object) ? null : object.split(spliceChar);
    }
}
